package qsc.designpattern.singleton;

/**
 *延迟加载 双重检查锁定
 */
public class Singleton2 {
     private Singleton2(){}

     private volatile static Singleton2 instance = null;

     private static Singleton2 getInstance(){
         if (instance == null){
             synchronized (Singleton2.class){
                 if (instance == null){
                     instance = new Singleton2();
                 }
             }
         }
         return instance;
     }
}
